package org.openit.portail.model;

import java.io.Serializable;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.WeakHashMap;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.proxy.HibernateProxy;


/** 
 * Object mapping for hibernate-handled table: action.
 * @author autogenerated
 */

@Entity
@Table(name = "action", catalog = "portail")
public class Action implements Cloneable, Serializable{

	/** Serial Version UID. */
	private static final long serialVersionUID = -559010020L;

	/** Use a WeakHashMap so entries will be garbage collected once all entities 
		referring to a saved hash are garbage collected themselves. */
	private static final Map<Serializable, Integer> SAVED_HASHES =
		Collections.synchronizedMap(new WeakHashMap<Serializable, Integer>());
	
	/** hashCode temporary storage. */
	private volatile Integer hashCode;
	

	/** Field mapping. */
	private Integer activerCompte;
	/** Field mapping. */
	private Integer consulterClt;
	/** Field mapping. */
	private Integer consulterModele;
	/** Field mapping. */
	private Integer consulterService;
	/** Field mapping. */
	private Integer consulterUtilisateur;
	/** Field mapping. */
	private Integer creerClt;
	/** Field mapping. */
	private Integer creerModele;
	/** Field mapping. */
	private Integer creerService;
	/** Field mapping. */
	private Integer creerUtilisateur;
	/** Field mapping. */
	private Integer desactiverCompte;
	/** Field mapping. */
	private Date dtCreation;
	/** Field mapping. */
	private Date dtModification;
	/** Field mapping. */
	private Integer id = 0; // init for hibernate bug workaround
	/** Field mapping. */
	private UserSystem idCreationUser;
	/** Field mapping. */
	private UserSystem idModificationUser;
	/** Field mapping. */
	private Integer modifierClt;
	/** Field mapping. */
	private Integer modifierModele;
	/** Field mapping. */
	private Integer modifierPassword;
	/** Field mapping. */
	private Integer modifierService;
	/** Field mapping. */
	private Integer modifierUtilisateur;
	/** Field mapping. */
	private Integer supprimerClt;
	/** Field mapping. */
	private Integer supprimerModele;
	/** Field mapping. */
	private Integer supprimerService;
	/** Field mapping. */
	private Integer supprimerUtilisateur;
	/**
	 * Default constructor, mainly for hibernate use.
	 */
	public Action() {
		// Default constructor
	} 

	/** Constructor taking a given ID.
	 * @param id to set
	 */
	public Action(Integer id) {
		this.id = id;
	}
	
 


 
	/** Return the type of this class. Useful for when dealing with proxies.
	* @return Defining class.
	*/
	@Transient
	public Class<?> getClassType() {
		return Action.class;
	}
 

    /**
     * Return the value associated with the column: activerCompte.
	 * @return A Integer object (this.activerCompte)
	 */
	@Column( name = "activer_compte"  )
	public Integer getActiverCompte() {
		return this.activerCompte;
		
	}
	

  
    /**  
     * Set the value related to the column: activerCompte.
	 * @param activerCompte the activerCompte value you wish to set
	 */
	public void setActiverCompte(final Integer activerCompte) {
		this.activerCompte = activerCompte;
	}

    /**
     * Return the value associated with the column: consulterClt.
	 * @return A Integer object (this.consulterClt)
	 */
	@Column( name = "consulter_clt"  )
	public Integer getConsulterClt() {
		return this.consulterClt;
		
	}
	

  
    /**  
     * Set the value related to the column: consulterClt.
	 * @param consulterClt the consulterClt value you wish to set
	 */
	public void setConsulterClt(final Integer consulterClt) {
		this.consulterClt = consulterClt;
	}

    /**
     * Return the value associated with the column: consulterModele.
	 * @return A Integer object (this.consulterModele)
	 */
	@Column( name = "consulter_modele"  )
	public Integer getConsulterModele() {
		return this.consulterModele;
		
	}
	

  
    /**  
     * Set the value related to the column: consulterModele.
	 * @param consulterModele the consulterModele value you wish to set
	 */
	public void setConsulterModele(final Integer consulterModele) {
		this.consulterModele = consulterModele;
	}

    /**
     * Return the value associated with the column: consulterService.
	 * @return A Integer object (this.consulterService)
	 */
	@Column( name = "consulter_service"  )
	public Integer getConsulterService() {
		return this.consulterService;
		
	}
	

  
    /**  
     * Set the value related to the column: consulterService.
	 * @param consulterService the consulterService value you wish to set
	 */
	public void setConsulterService(final Integer consulterService) {
		this.consulterService = consulterService;
	}

    /**
     * Return the value associated with the column: consulterUtilisateur.
	 * @return A Integer object (this.consulterUtilisateur)
	 */
	@Column( name = "consulter_utilisateur"  )
	public Integer getConsulterUtilisateur() {
		return this.consulterUtilisateur;
		
	}
	

  
    /**  
     * Set the value related to the column: consulterUtilisateur.
	 * @param consulterUtilisateur the consulterUtilisateur value you wish to set
	 */
	public void setConsulterUtilisateur(final Integer consulterUtilisateur) {
		this.consulterUtilisateur = consulterUtilisateur;
	}

    /**
     * Return the value associated with the column: creerClt.
	 * @return A Integer object (this.creerClt)
	 */
	@Column( name = "creer_clt"  )
	public Integer getCreerClt() {
		return this.creerClt;
		
	}
	

  
    /**  
     * Set the value related to the column: creerClt.
	 * @param creerClt the creerClt value you wish to set
	 */
	public void setCreerClt(final Integer creerClt) {
		this.creerClt = creerClt;
	}

    /**
     * Return the value associated with the column: creerModele.
	 * @return A Integer object (this.creerModele)
	 */
	@Column( name = "creer_modele"  )
	public Integer getCreerModele() {
		return this.creerModele;
		
	}
	

  
    /**  
     * Set the value related to the column: creerModele.
	 * @param creerModele the creerModele value you wish to set
	 */
	public void setCreerModele(final Integer creerModele) {
		this.creerModele = creerModele;
	}

    /**
     * Return the value associated with the column: creerService.
	 * @return A Integer object (this.creerService)
	 */
	@Column( name = "creer_service"  )
	public Integer getCreerService() {
		return this.creerService;
		
	}
	

  
    /**  
     * Set the value related to the column: creerService.
	 * @param creerService the creerService value you wish to set
	 */
	public void setCreerService(final Integer creerService) {
		this.creerService = creerService;
	}

    /**
     * Return the value associated with the column: creerUtilisateur.
	 * @return A Integer object (this.creerUtilisateur)
	 */
	@Column( name = "creer_utilisateur"  )
	public Integer getCreerUtilisateur() {
		return this.creerUtilisateur;
		
	}
	

  
    /**  
     * Set the value related to the column: creerUtilisateur.
	 * @param creerUtilisateur the creerUtilisateur value you wish to set
	 */
	public void setCreerUtilisateur(final Integer creerUtilisateur) {
		this.creerUtilisateur = creerUtilisateur;
	}

    /**
     * Return the value associated with the column: desactiverCompte.
	 * @return A Integer object (this.desactiverCompte)
	 */
	@Column( name = "desactiver_compte"  )
	public Integer getDesactiverCompte() {
		return this.desactiverCompte;
		
	}
	

  
    /**  
     * Set the value related to the column: desactiverCompte.
	 * @param desactiverCompte the desactiverCompte value you wish to set
	 */
	public void setDesactiverCompte(final Integer desactiverCompte) {
		this.desactiverCompte = desactiverCompte;
	}

    /**
     * Return the value associated with the column: dtCreation.
	 * @return A Date object (this.dtCreation)
	 */
	@Column( name = "dt_creation"  )
	public Date getDtCreation() {
		return this.dtCreation;
		
	}
	

  
    /**  
     * Set the value related to the column: dtCreation.
	 * @param dtCreation the dtCreation value you wish to set
	 */
	public void setDtCreation(final Date dtCreation) {
		this.dtCreation = dtCreation;
	}

    /**
     * Return the value associated with the column: dtModification.
	 * @return A Date object (this.dtModification)
	 */
	@Column( name = "dt_modification"  )
	public Date getDtModification() {
		return this.dtModification;
		
	}
	

  
    /**  
     * Set the value related to the column: dtModification.
	 * @param dtModification the dtModification value you wish to set
	 */
	public void setDtModification(final Date dtModification) {
		this.dtModification = dtModification;
	}

    /**
     * Return the value associated with the column: id.
	 * @return A Integer object (this.id)
	 */
    @Id 
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column( name = "id_act", nullable = false  )
	public Integer getId() {
		return this.id;
		
	}
	

  
    /**  
     * Set the value related to the column: id.
	 * @param id the id value you wish to set
	 */
	public void setId(final Integer id) {
		// If we've just been persisted and hashCode has been
		// returned then make sure other entities with this
		// ID return the already returned hash code
		if ( (this.id == null || this.id == 0) &&
				(id != null) &&
				(this.hashCode != null) ) {
			SAVED_HASHES.put( id, this.hashCode );
		}
		this.id = id;
	}

    /**
     * Return the value associated with the column: idCreationUser.
	 * @return A UserSystem object (this.idCreationUser)
	 */
	@ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY )
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
	@JoinColumn(name = "Id_Creation_User", nullable = true )
	public UserSystem getIdCreationUser() {
		return this.idCreationUser;
		
	}
	

  
    /**  
     * Set the value related to the column: idCreationUser.
	 * @param idCreationUser the idCreationUser value you wish to set
	 */
	public void setIdCreationUser(final UserSystem idCreationUser) {
		this.idCreationUser = idCreationUser;
	}

    /**
     * Return the value associated with the column: idModificationUser.
	 * @return A UserSystem object (this.idModificationUser)
	 */
	@ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY )
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
	@JoinColumn(name = "Id_Modification_User", nullable = true )
	public UserSystem getIdModificationUser() {
		return this.idModificationUser;
		
	}
	

  
    /**  
     * Set the value related to the column: idModificationUser.
	 * @param idModificationUser the idModificationUser value you wish to set
	 */
	public void setIdModificationUser(final UserSystem idModificationUser) {
		this.idModificationUser = idModificationUser;
	}

    /**
     * Return the value associated with the column: modifierClt.
	 * @return A Integer object (this.modifierClt)
	 */
	@Column( name = "modifier_clt"  )
	public Integer getModifierClt() {
		return this.modifierClt;
		
	}
	

  
    /**  
     * Set the value related to the column: modifierClt.
	 * @param modifierClt the modifierClt value you wish to set
	 */
	public void setModifierClt(final Integer modifierClt) {
		this.modifierClt = modifierClt;
	}

    /**
     * Return the value associated with the column: modifierModele.
	 * @return A Integer object (this.modifierModele)
	 */
	@Column( name = "modifier_modele"  )
	public Integer getModifierModele() {
		return this.modifierModele;
		
	}
	

  
    /**  
     * Set the value related to the column: modifierModele.
	 * @param modifierModele the modifierModele value you wish to set
	 */
	public void setModifierModele(final Integer modifierModele) {
		this.modifierModele = modifierModele;
	}

    /**
     * Return the value associated with the column: modifierPassword.
	 * @return A Integer object (this.modifierPassword)
	 */
	@Column( name = "modifier_password"  )
	public Integer getModifierPassword() {
		return this.modifierPassword;
		
	}
	

  
    /**  
     * Set the value related to the column: modifierPassword.
	 * @param modifierPassword the modifierPassword value you wish to set
	 */
	public void setModifierPassword(final Integer modifierPassword) {
		this.modifierPassword = modifierPassword;
	}

    /**
     * Return the value associated with the column: modifierService.
	 * @return A Integer object (this.modifierService)
	 */
	@Column( name = "modifier_service"  )
	public Integer getModifierService() {
		return this.modifierService;
		
	}
	

  
    /**  
     * Set the value related to the column: modifierService.
	 * @param modifierService the modifierService value you wish to set
	 */
	public void setModifierService(final Integer modifierService) {
		this.modifierService = modifierService;
	}

    /**
     * Return the value associated with the column: modifierUtilisateur.
	 * @return A Integer object (this.modifierUtilisateur)
	 */
	@Column( name = "modifier_utilisateur"  )
	public Integer getModifierUtilisateur() {
		return this.modifierUtilisateur;
		
	}
	

  
    /**  
     * Set the value related to the column: modifierUtilisateur.
	 * @param modifierUtilisateur the modifierUtilisateur value you wish to set
	 */
	public void setModifierUtilisateur(final Integer modifierUtilisateur) {
		this.modifierUtilisateur = modifierUtilisateur;
	}
    /**
     * Return the value associated with the column: supprimerClt.
	 * @return A Integer object (this.supprimerClt)
	 */
	@Column( name = "supprimer_clt"  )
	public Integer getSupprimerClt() {
		return this.supprimerClt;
		
	} 
    /**  
     * Set the value related to the column: supprimerClt.
	 * @param supprimerClt the supprimerClt value you wish to set
	 */
	public void setSupprimerClt(final Integer supprimerClt) {
		this.supprimerClt = supprimerClt;
	}

    /**
     * Return the value associated with the column: supprimerModele.
	 * @return A Integer object (this.supprimerModele)
	 */
	@Column( name = "supprimer_modele"  )
	public Integer getSupprimerModele() {
		return this.supprimerModele;
		
	}
	

  
    /**  
     * Set the value related to the column: supprimerModele.
	 * @param supprimerModele the supprimerModele value you wish to set
	 */
	public void setSupprimerModele(final Integer supprimerModele) {
		this.supprimerModele = supprimerModele;
	}

    /**
     * Return the value associated with the column: supprimerService.
	 * @return A Integer object (this.supprimerService)
	 */
	@Column( name = "supprimer_service"  )
	public Integer getSupprimerService() {
		return this.supprimerService;
		
	}
	

  
    /**  
     * Set the value related to the column: supprimerService.
	 * @param supprimerService the supprimerService value you wish to set
	 */
	public void setSupprimerService(final Integer supprimerService) {
		this.supprimerService = supprimerService;
	}

    /**
     * Return the value associated with the column: supprimerUtilisateur.
	 * @return A Integer object (this.supprimerUtilisateur)
	 */
	@Column( name = "supprimer_utilisateur"  )
	public Integer getSupprimerUtilisateur() {
		return this.supprimerUtilisateur;
		
	}
	

  
    /**  
     * Set the value related to the column: supprimerUtilisateur.
	 * @param supprimerUtilisateur the supprimerUtilisateur value you wish to set
	 */
	public void setSupprimerUtilisateur(final Integer supprimerUtilisateur) {
		this.supprimerUtilisateur = supprimerUtilisateur;
	}


   /**
    * Deep copy.
	* @return cloned object
	* @throws CloneNotSupportedException on error
    */
    @Override
    public Action clone() throws CloneNotSupportedException {
		
        final Action copy = (Action)super.clone();

		copy.setActiverCompte(this.getActiverCompte());
		copy.setConsulterClt(this.getConsulterClt());
		copy.setConsulterModele(this.getConsulterModele());
		copy.setConsulterService(this.getConsulterService());
		copy.setConsulterUtilisateur(this.getConsulterUtilisateur());
		copy.setCreerClt(this.getCreerClt());
		copy.setCreerModele(this.getCreerModele());
		copy.setCreerService(this.getCreerService());
		copy.setCreerUtilisateur(this.getCreerUtilisateur());
		copy.setDesactiverCompte(this.getDesactiverCompte());
		copy.setDtCreation(this.getDtCreation());
		copy.setDtModification(this.getDtModification());
		copy.setId(this.getId());
		copy.setIdCreationUser(this.getIdCreationUser());
		copy.setIdModificationUser(this.getIdModificationUser());
		copy.setModifierClt(this.getModifierClt());
		copy.setModifierModele(this.getModifierModele());
		copy.setModifierPassword(this.getModifierPassword());
		copy.setModifierService(this.getModifierService());
		copy.setModifierUtilisateur(this.getModifierUtilisateur());
		copy.setSupprimerClt(this.getSupprimerClt());
		copy.setSupprimerModele(this.getSupprimerModele());
		copy.setSupprimerService(this.getSupprimerService());
		copy.setSupprimerUtilisateur(this.getSupprimerUtilisateur());
		return copy;
	}
	


	/** Provides toString implementation.
	 * @see java.lang.Object#toString()
	 * @return String representation of this class.
	 */
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		
		sb.append("activerCompte: " + this.getActiverCompte() + ", ");
		sb.append("consulterClt: " + this.getConsulterClt() + ", ");
		sb.append("consulterModele: " + this.getConsulterModele() + ", ");
		sb.append("consulterService: " + this.getConsulterService() + ", ");
		sb.append("consulterUtilisateur: " + this.getConsulterUtilisateur() + ", ");
		sb.append("creerClt: " + this.getCreerClt() + ", ");
		sb.append("creerModele: " + this.getCreerModele() + ", ");
		sb.append("creerService: " + this.getCreerService() + ", ");
		sb.append("creerUtilisateur: " + this.getCreerUtilisateur() + ", ");
		sb.append("desactiverCompte: " + this.getDesactiverCompte() + ", ");
		sb.append("dtCreation: " + this.getDtCreation() + ", ");
		sb.append("dtModification: " + this.getDtModification() + ", ");
		sb.append("id: " + this.getId() + ", ");
		sb.append("modifierClt: " + this.getModifierClt() + ", ");
		sb.append("modifierModele: " + this.getModifierModele() + ", ");
		sb.append("modifierPassword: " + this.getModifierPassword() + ", ");
		sb.append("modifierService: " + this.getModifierService() + ", ");
		sb.append("modifierUtilisateur: " + this.getModifierUtilisateur() + ", ");
		sb.append("supprimerClt: " + this.getSupprimerClt() + ", ");
		sb.append("supprimerModele: " + this.getSupprimerModele() + ", ");
		sb.append("supprimerService: " + this.getSupprimerService() + ", ");
		sb.append("supprimerUtilisateur: " + this.getSupprimerUtilisateur());
		return sb.toString();		
	}


	/** Equals implementation. 
	 * @see java.lang.Object#equals(java.lang.Object)
	 * @param aThat Object to compare with
	 * @return true/false
	 */
	@Override
	public boolean equals(final Object aThat) {
		Object proxyThat = aThat;
		
		if ( this == aThat ) {
			 return true;
		}

		
		if (aThat instanceof HibernateProxy) {
 			// narrow down the proxy to the class we are dealing with.
 			try {
				proxyThat = ((HibernateProxy) aThat).getHibernateLazyInitializer().getImplementation(); 
			} catch (org.hibernate.ObjectNotFoundException e) {
				return false;
		   	}
		}
		if (aThat == null)  {
			 return false;
		}
		
		final Action that; 
		try {
			that = (Action) proxyThat;
			if ( !(that.getClassType().equals(this.getClassType()))){
				return false;
			}
		} catch (org.hibernate.ObjectNotFoundException e) {
				return false;
		} catch (ClassCastException e) {
				return false;
		}
		
		
		boolean result = true;
		result = result && (((this.getId() == null) && ( that.getId() == null)) || (this.getId() != null  && this.getId().equals(that.getId())));
		result = result && (((getActiverCompte() == null) && (that.getActiverCompte() == null)) || (getActiverCompte() != null && getActiverCompte().equals(that.getActiverCompte())));
		result = result && (((getConsulterClt() == null) && (that.getConsulterClt() == null)) || (getConsulterClt() != null && getConsulterClt().equals(that.getConsulterClt())));
		result = result && (((getConsulterModele() == null) && (that.getConsulterModele() == null)) || (getConsulterModele() != null && getConsulterModele().equals(that.getConsulterModele())));
		result = result && (((getConsulterService() == null) && (that.getConsulterService() == null)) || (getConsulterService() != null && getConsulterService().equals(that.getConsulterService())));
		result = result && (((getConsulterUtilisateur() == null) && (that.getConsulterUtilisateur() == null)) || (getConsulterUtilisateur() != null && getConsulterUtilisateur().equals(that.getConsulterUtilisateur())));
		result = result && (((getCreerClt() == null) && (that.getCreerClt() == null)) || (getCreerClt() != null && getCreerClt().equals(that.getCreerClt())));
		result = result && (((getCreerModele() == null) && (that.getCreerModele() == null)) || (getCreerModele() != null && getCreerModele().equals(that.getCreerModele())));
		result = result && (((getCreerService() == null) && (that.getCreerService() == null)) || (getCreerService() != null && getCreerService().equals(that.getCreerService())));
		result = result && (((getCreerUtilisateur() == null) && (that.getCreerUtilisateur() == null)) || (getCreerUtilisateur() != null && getCreerUtilisateur().equals(that.getCreerUtilisateur())));
		result = result && (((getDesactiverCompte() == null) && (that.getDesactiverCompte() == null)) || (getDesactiverCompte() != null && getDesactiverCompte().equals(that.getDesactiverCompte())));
		result = result && (((getDtCreation() == null) && (that.getDtCreation() == null)) || (getDtCreation() != null && getDtCreation().equals(that.getDtCreation())));
		result = result && (((getDtModification() == null) && (that.getDtModification() == null)) || (getDtModification() != null && getDtModification().equals(that.getDtModification())));
		result = result && (((getIdCreationUser() == null) && (that.getIdCreationUser() == null)) || (getIdCreationUser() != null && getIdCreationUser().getId().equals(that.getIdCreationUser().getId())));	
		result = result && (((getIdModificationUser() == null) && (that.getIdModificationUser() == null)) || (getIdModificationUser() != null && getIdModificationUser().getId().equals(that.getIdModificationUser().getId())));	
		result = result && (((getModifierClt() == null) && (that.getModifierClt() == null)) || (getModifierClt() != null && getModifierClt().equals(that.getModifierClt())));
		result = result && (((getModifierModele() == null) && (that.getModifierModele() == null)) || (getModifierModele() != null && getModifierModele().equals(that.getModifierModele())));
		result = result && (((getModifierPassword() == null) && (that.getModifierPassword() == null)) || (getModifierPassword() != null && getModifierPassword().equals(that.getModifierPassword())));
		result = result && (((getModifierService() == null) && (that.getModifierService() == null)) || (getModifierService() != null && getModifierService().equals(that.getModifierService())));
		result = result && (((getModifierUtilisateur() == null) && (that.getModifierUtilisateur() == null)) || (getModifierUtilisateur() != null && getModifierUtilisateur().equals(that.getModifierUtilisateur())));
		result = result && (((getSupprimerClt() == null) && (that.getSupprimerClt() == null)) || (getSupprimerClt() != null && getSupprimerClt().equals(that.getSupprimerClt())));
		result = result && (((getSupprimerModele() == null) && (that.getSupprimerModele() == null)) || (getSupprimerModele() != null && getSupprimerModele().equals(that.getSupprimerModele())));
		result = result && (((getSupprimerService() == null) && (that.getSupprimerService() == null)) || (getSupprimerService() != null && getSupprimerService().equals(that.getSupprimerService())));
		result = result && (((getSupprimerUtilisateur() == null) && (that.getSupprimerUtilisateur() == null)) || (getSupprimerUtilisateur() != null && getSupprimerUtilisateur().equals(that.getSupprimerUtilisateur())));
		return result;
	}
	
	/** Calculate the hashcode.
	 * @see java.lang.Object#hashCode()
	 * @return a calculated number
	 */
	@Override
	public int hashCode() {
		if ( this.hashCode == null ) {
			synchronized ( this ) {
				if ( this.hashCode == null ) {
					Integer newHashCode = null;

					if ( getId() != null ) {
						newHashCode = SAVED_HASHES.get( getId() );
					}
					
					if ( newHashCode == null ) {
						if ( getId() != null && getId() != 0) {
							newHashCode = getId();
						} else {
							newHashCode = super.hashCode();

						}
					}
					
					this.hashCode = newHashCode;
				}
			}
		}
	return this.hashCode;
	}
	

	
}
